package com.clouddisk.common.helper;

import org.springframework.stereotype.Component;

import java.io.InputStream;
import java.util.Properties;

/**
 * @author ZJH
 */
@Component
public class ConfigManager {

    private static Properties properties;

    static {
        Init();
    }

    private static void Init() {
        try {
            properties = new Properties();
            InputStream stream = ConfigManager.class.getResourceAsStream("/config/settings.properties");
            properties.load(stream);
        } catch (Exception ex) {
            properties = null;
        }
    }

    public static String GetProperty(String name) {
        if (properties == null) {
            return "";
        }

        String property = properties.getProperty(name);

        return property == null ? "" : property;
    }
}
